package com.hardydou.system.service.impl;

import com.hardydou.system.mapper.SystemOperLogMapper;
import com.hardydou.system.model.SystemOperLog;
import com.hardydou.system.service.ISystemOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author ：hardy
 * @description：操作日志服务
 * @date ：Created in 2020/6/1
 * @Copyright ：Hardydou.com
 */
@Service
public class SystemOperLogServiceImpl implements ISystemOperLogService {

    @Autowired
    private SystemOperLogMapper operLogMapper;

    @Override
    public SystemOperLog findById(Long operLogId) {
        return operLogMapper.selectByPrimaryKey(operLogId);
    }

    @Override
    public List<SystemOperLog> findAll(Map params) {
        return operLogMapper.findAll(params);
    }

    @Override
    public int add(SystemOperLog operLog) {
        Date date = new Date();
        operLog.setCtime(date);
        operLog.setUtime(date);
        return operLogMapper.insert(operLog);
    }

    @Override
    public int update(SystemOperLog operLog) {
        return operLogMapper.updateByPrimaryKeySelective(operLog);
    }

    @Override
    public int deleteById(Long operLogId) {
        return operLogMapper.deleteByPrimaryKey(operLogId);
    }
}
